<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #focus{
            width: 100px;
            height: 54px;
            margin: 0 auto;
            overflow: hidden;
            position: relative;
        }
        #focus .imgs{
            width: 500px;
            overflow: hidden;
            position: absolute;
        }
        #focus .imgs .img{
            float: left;
            width: 100px;
            height: 54px;
        }
        #focus .imgs .img img{
            width: 100%;
        }
        #focus .nav{
            position: absolute;
            top: 50%;
            width: 10px;
            height: 10px;
            margin-top: -5px;
            opacity: 0;
            cursor: pointer;
            z-index: 9;
        }
        #focus .nav:hover{
            opacity: 1;
            background-color: #ccc;
        }
        #focus .n-left{
            left: 0;
            border-radius: 0 50% 50% 0;
        }
        #focus .n-right{
            right: 0;
            border-radius: 50% 0 0 50%;
        }
    </style>
    <script src="../lib/jquery-1.11.3.min.js"></script>
</head>
<body>
    <div id="focus">
        <img src="imgs/10.png" alt="" class="nav n-left">
        <div class="imgs">
            <div class="img"><img src="imgs/3.png" alt=""></div>
            <div class="img"><img src="imgs/4.png" alt=""></div>
            <div class="img"><img src="imgs/5.png" alt=""></div>
            <div class="img"><img src="imgs/7.png" alt=""></div>
            <div class="img"><img src="imgs/8.png" alt=""></div>
        </div>
        <img src="imgs/p1.png" alt="" class="nav n-right">
    </div>
    <script>
        var $left=$('.n-left')
        var $right=$('.n-right')
        var $imgs=$('.imgs')
        var $width=500,$sglw=100

        $left.on('click',function(){
            if($imgs[0].offsetLeft==0){
                $(imgs[0].style.left=-$width+'px')
                // $imgs.animate({'left':-$width},300)
            }else{
                var num=$imgs[0].offsetLeft+$sglw
                // $imgs[0].style.left=num+'px'
                $imgs.filter(':not(:animated)').animate({'left':num},300)
            }
        })
        
        $right.on('click',function(){
            if($imgs[0].offsetLeft==-($width-$sglw)){
                $(imgs[0].style.left=0)
                // $imgs.animate({'left':0},300)
            }else{
                var num=$imgs[0].offsetLeft-$sglw
                // $imgs[0].style.left=num+'px'
                $imgs.filter(':not(:animated)').animate({'left':num},300)
            }
            
        })
    </script>
</body>
</html>